import Vue from 'vue'
import Vuex from 'vuex'


Vue.use(Vuex)

const store = new Vuex.Store({
  state: {
    count : 1,
    username: "ab",
    app : ''
  },
  mutations: {
    updateCount (state,num) {
      console.log(state)
      console.log(num)
      state.count = num
    }
  },
  actions: {
  },
  modules: {
    user:{
      namespaced: true,
      state: {
        username : localStorage.getItem("token") ? 
        JSON.parse(localStorage.getItem("token")) : ""
      },
      mutations: {
        updateCount (state,num) {
          console.log(state)
          console.log(num)
          state.username = num
        }
      }
    }
  }
})
export default store



